package com.cnoja.jmsncn.command.commands;

import java.util.Arrays;

import com.cnoja.jmsncn.command.DefaultCommand;
import com.cnoja.jmsncn.inf.IResponse;
import com.cnoja.jmsncn.kernel.exceptions.CommandValidateException;
import com.cnoja.jmsncn.utils.command.CommandUtils;
import com.cnoja.jmsncn.utils.text.StringUtils;

public class VersionCommand extends DefaultCommand {
	private String[] versions = null;

	public VersionCommand(String commandString) {
		super(commandString);
		String[] split = commandString.split("\\s");
		this.versions = Arrays.copyOfRange(split, 2, split.length - 1);

	}

	@Override
	public void validateResponse(IResponse response)
			throws CommandValidateException {
		String[] split = CommandUtils.split(response.getResponseContent());
		validateLength(split, 3, -1);
		validateContains(this.versions, split[2]);
	}

}
